#ifndef _QUANTUM_WINDOW_H__
#define _QUANTUM_WINDOW_H__

#include "layout/layout_manager.h"
#include "layout/layout_power_manager.h"
#include "type.h"
#include "typedefines/area.h"
#include <memory>
#include <ncursesw/ncurses.h>
#include <vector>

enum class WindowStatus {
	NORMAL,
	EXIT,
};

class View;
class Buffer;

class Window {

  private:
	std::vector<std::shared_ptr<View>> _views;
	int _active_view_index;
	WindowStatus _status;
	Area _window_area;
	LayoutPowerManager _layout_manager;

  public:
	Window();
	void create_view(LayoutMode mode, bool active = true,
					 std::shared_ptr<Buffer> buffer = nullptr);

	void update_window_size() {
		_window_area.cols = COLS;
		_window_area.lines = LINES;
	}
	void update_all();
	void update();

	// Events
	void key_input_event(type::input_type ch);

	void next_view();
	void prev_view();
	void set_active_view_index(size_t index) { _active_view_index = index; }
	std::shared_ptr<View> get_active_view();
	WindowStatus get_status() const { return _status; }
	Area get_window_area() const { return _window_area; };
	~Window();
};

#endif // _QUANTUM_WINDOW_H__
